package com.xiweicheng.testmultischema;

import com.xiweicheng.testmultischema.mybatis.XxxDao;
import com.xiweicheng.testmultischema.mybatis.entity.Xxx;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.UUID;

@SpringBootApplication
@Data
@Slf4j
public class TestMultiSchemaApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(TestMultiSchemaApplication.class, args);
    }

    @Autowired
    XxxDao xxxDao;

    @Override
    public void run(String... args) throws Exception {

        String id = UUID.randomUUID().toString();

        xxxDao.insert(Xxx.builder().id(id).name("zhangsan").age(30L).build());

        Xxx xxx = xxxDao.selectByPrimaryKey(id);

        log.info("get xxx: {}", xxx);
    }
}
